package com.ilink.groundservice.service.impl.dataset;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ilink.groundservice.entity.PO.dataset.DatasetIntroduction;
import com.ilink.groundservice.entity.PO.dataset.DatasetPublish;
import com.ilink.groundservice.service.dataset.DatasetPublishService;
import com.ilink.groundservice.mapper.dataset.DatasetPublishMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
* @author LENOVO
* @description 针对表【dataset_publish】的数据库操作Service实现
* @createDate 2024-09-16 18:23:02
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class DatasetPublishServiceImpl extends ServiceImpl<DatasetPublishMapper, DatasetPublish>
    implements DatasetPublishService{
    private final DatasetPublishMapper datasetPublishMapper;

    @Override
    public DatasetPublish getDatasetsPublish(String targetId){
        try{
            LambdaQueryWrapper<DatasetPublish> publishWrapper = new LambdaQueryWrapper<>();
            // 使用 Lambda 表达式查询 datasetId 等于 targetId 的记录
            publishWrapper.eq(DatasetPublish::getDatasetId, targetId).last("limit 1");
            // 查询返回单个结果
            return datasetPublishMapper.selectOne(publishWrapper);
        }catch (Exception e){
            log.error("函数getDatasetsPublish"+e.getMessage());
            return null;
        }
    }
}




